package rtda

import (
	. "jvm/typedef"
)

const vmStackCapacity = 1024

type Thread struct {
	pc    U4
	stack vmStack
}

func NewThread() *Thread {
	thread := &Thread{
		pc:    0,
		stack: *NewVMStack(vmStackCapacity),
	}
	return thread
}
func (self *Thread) CurrentFrame() *Frame {
	return self.stack.Top()
}
func (self *Thread) PushFrame(frame *Frame) {
	self.stack.Push(frame)
}
func (self *Thread) PopFrame() *Frame {
	return self.stack.Pop()
}
